import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/index',
    children:[
      {
        path: '/index',
        component: ()=>import('../views/home/IndexView'),
      },
      {
        path: '/login',
        component: ()=>import('../views/home/LoginView'),
      },
      {
        path: '/reg',
        component: ()=>import('../views/home/RegView'),
      },
      {
        path: '/list',
        component: ()=>import('../views/home/ListView'),
      },
      {
        path: '/detail',
        component: ()=>import('../views/home/DetailView'),
      },
      {
        path: '/personal',
        component: ()=>import('../views/home/PersonalView'),
        children:[
          {
            path: '/personal/index',
            component: ()=>import('../views/home/personal/PersonalIndexView'),
          },
          {
            path: '/personal/management',
            component: ()=>import('../views/home/personal/PersonalManagementView'),
          },
          {
            path: '/personal/post',
            component: ()=>import('../views/home/personal/PersonalPostView'),
          },

        ]
      },
    ]
  },
  {
    path: '/admin',
    component: ()=>import('../views/AdminView'),
    redirect: '/admin/index',
    children: [
      {
        path: '/admin/index',
        component: ()=>import('../views/admin/AdminIndexView'),
      },
      {
        path: '/admin/banner',
        component: ()=>import('../views/admin/AdminBannerView'),
      },
      {
        path: '/admin/content',
        component: ()=>import('../views/admin/AdminContentView'),
      }
    ]
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
